#include<iostream>
using namespace std;

struct Node{
    int l, r;
}tr[130];

void dfs(int root) {
    if(!root)   return;
    printf("%c", root + 'a' - 1);
    dfs(tr[root].l);
    dfs(tr[root].r);
}

int main() {
    int n, root = 0;
    cin >> n;
    while(n--) {
        char ch[4];
        scanf("%s", ch);
        int rt = ch[0] - 'a' + 1;
        if(!root)    root = rt;
        if(ch[1] != '*')    tr[rt].l = ch[1] - 'a' + 1;
        else    tr[rt].l = 0;
        if(ch[2] != '*')    tr[rt].r = ch[2] - 'a' + 1;
        else    tr[rt].r = 0;
    }
    dfs(root);
    return 0;
} 